package com.qf.service;

import com.qf.dao.UserDao;
import com.qf.pojo.User;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.List;

/**
 * @author mkr
 * @version V1.0
 * @Project java2203-mkr
 * @Package com.qf.service
 * @Description:
 * @Date 2022/6/2 9:32
 */
public class UserServiceIpml1 implements UserService {
    //注入全局属性
    private UserDao userDao;

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        System.out.println("===执行set注入===");
        this.userDao = userDao;
    }

    /**
     * 初始化
     */
    @PostConstruct
    public void init(){
        System.out.println("===UserServiceIpml1初始化===");
    }

    /**
     * 无参构造
     */
    public UserServiceIpml1() {
        System.out.println("===UserServiceIpml1执行构造===");
    }

    /**
     * 销毁
     */
    @PreDestroy
    public void destroy(){
        System.out.println("===UserServiceIpml1销毁===");
    }

    @Override
    public void registUser() {

        userDao.inserUser();
        System.out.println("====UserService第一个实现类=========");
    }

    @Override
    public List<User> findUserAll() {
        //开启事务
        System.out.println("====执行findUserAll方法=========");
        //结束提交事务

        //打印日志
        return null;
    }

    @Override
    public void insertUser(User user) {
        System.out.println("====执行insertUser方法=========");
    }

    @Override
    public void updateUser(User user) {
        System.out.println("====执行updateUser方法=========");
    }

    @Override
    public void deleteUser(Integer id) {
        System.out.println("====执行deleteUser方法=========");
    }


}
